package com.shangxia.monomer.study.designPatterns.creationType.factory.ordinary;

import com.shangxia.monomer.study.designPatterns.creationType.factory.base.*;
import lombok.extern.slf4j.Slf4j;

/**
 * @ProjectName: monomer
 * @ClassName: FruitFactory
 * @Time: 2021/7/19
 * @Author: zhouy
 * @Description:
 * @Experience:
 */

@Slf4j
public class FruitFactory {

    public Fruit createFruit(FruitNameEnum name){
        switch (name) {
            case APPLE:
                return new Apple("apple", ColourEnum.ERD);
            case BANANA:
                return new Banana("banana", ColourEnum.YELLOW);
            case ORANGE:
                return new Orange("", ColourEnum.ORANGE);
            default:
                return null;
        }
    }

}
